//
//  VIZTipController.m
//  Young-Old
//
//  Created by 位立志 on 16/4/30.
//  Copyright © 2016年 位立志. All rights reserved.
//

#import "VIZTipController.h"


@interface VIZTipController ()

@property(nonatomic,weak)UITextField *tipTextField;

@end

@implementation VIZTipController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTextField];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(backClick)];
    
}

//返回标签
- (void)backClick{
    
    [self.tipTextField endEditing:YES];
    self.tip = self.tipTextField.text;
    self.tipStr(self.tip);

    [self.navigationController popToRootViewControllerAnimated:YES];
    
}



- (void)setTextField{
    
    //设置TextField
    self.view.backgroundColor = [UIColor whiteColor];
    
    UITextField *tipTextField = [[UITextField alloc]initWithFrame:self.view.frame];
    
    
    
    tipTextField.y = self.view.frame.size.height/3;
    
    tipTextField.height = 50;
    
    self.tipTextField = tipTextField;
    
    self.tipTextField.backgroundColor = [UIColor redColor];
    
    //添加保存方法
//    [self.tipTextField addTarget:self action:@selector(tipTextFieldValueChanged:) forControlEvents:UIControlEventValueChanged];
    
    [self.view addSubview:tipTextField];

    
}





////存储VIZTipKey
//- (void)tipTextFieldValueChanged:(UITextField *)tipTextField{
//    
////    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
////    
////    [userDefault setObject:tipTextField.text forKey:VIZTipKey];
////    
////    [userDefault synchronize];
//    NSLog(@"11111");
//    self.tip = tipTextField.text;
//    NSLog(@"%@",self.tip);
//    
//    
//}










@end
